package com.tt.payee.mapper;

import com.tt.payee.domain.SysUser;
import com.tt.payee.domain.vo.SysUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.MyMapper;

import java.util.Date;
import java.util.List;

/**
 * @author     ：Tang
 * @date       ：Created in 2020/7/22 15:31
 * @description：${description}
 * @modified By：
 * @version:     $version$
 */
@Mapper
public interface SysUserMapper extends MyMapper<SysUser> {
    /**
     * 根据条件获取用户
     *
     * @param sysUser
     * @return
     */
    List<SysUserVo> getUsersByRules(@Param("sysUser") SysUser sysUser,
                                    @Param("registryStartDate") String registryStartDate,
                                    @Param("registryEndDate") String registryEndDate,
                                    @Param("birthdayStartDate") String birthdayStartDate,
                                    @Param("birthdayEndDate") String birthdayEndDate,
                                    @Param("labelId") Integer labelId
    );

    /**
     * 根据Uid获取User
     *
     * @param uid
     * @return
     */
    SysUser getUserByUid(@Param("uid") Integer uid);

    /**
     * 根据topReferralCode获取User
     *
     * @param topReferralCode
     * @return
     */
    SysUser getUserByTopReferralCode(@Param("topReferralCode") String topReferralCode);


    /**
     * 获取所有用户
     *
     * @return
     */
    List<SysUser> getAllUsers();

    /**
     * 获取所有用户带标签
     *
     * @return
     */
    List<SysUserVo> getAllUsersWithLabel();

    /**
     * 编辑用户状态
     *
     * @param uid
     * @param status
     * @return
     */
    int updateUserStatus(@Param("uid") Integer uid, @Param("status") Integer status);

    /**
     * 新增积分修改日志
     *
     * @param uid
     * @param type
     * @param pointInChange
     * @param afterPoint
     * @param createDate
     * @param message
     * @return
     */
    Integer addPointLog(@Param("uid") Integer uid,
                        @Param("type") Integer type,
                        @Param("pointInChange") Double pointInChange,
                        @Param("afterPoint") Double afterPoint,
                        @Param("createDate") Date createDate,
                        @Param("message") String message);

    /**
     * 修改指定用户积分
     *
     * @param uid
     * @param point
     * @return
     */
    Integer updateUserPoint(@Param("uid") Integer uid,
                            @Param("point") Double point);

    /**
     * 修改指定用户备注
     *
     * @param uid
     * @param remark
     * @return
     */
    Integer updateUserRemark(@Param("uid") Integer uid,
                             @Param("remark") String remark);

    /**
     * 修改用户邀请数量
     *
     * @return
     */
    Integer updateUnrefereedNam();


    /**
     * 获取用户我的页面信息
     *
     * @return
     */
    SysUserVo selectUserInformation(@Param("uid") Integer uid);


    /**
     * 获取用户我的佣金信息
     *
     * @param uid
     * @return
     */
    SysUserVo selectUserCommission(@Param("uid") Integer uid);
}